import React, {Component} from 'react'

export default class betCenterRightContent extends Component {
  constructor (props){
   super(props)
   this.state= {
    hover:0
   }
}
chooseCodeType(code,index){
  // console.log(code);
  this.setState({
    hover:index
  })
  this.props.righttab(code,index)
}
componentWillReceiveProps(newProps){
   if(this.props.content != newProps.content){
     this.setState({
       hover:0
     })
   }
}
   render() {
    const {content} = this.props
    const {hover} = this.state
    const xzlxlist = content.xzlxList || []
    if(xzlxlist.lenght){
      return <ul>
      </ul>
    }
    return <ul>
              {
                xzlxlist.map((ele,i)=>{
                  return <li key={i} className={hover == i ? "hover" : ""}
                   onClick={()=>{this.chooseCodeType(ele.xzlxCode,i)}}>{ele.xzlxName}</li>
                })
              }
        </ul>
   }
}